﻿using System;

namespace CrowdPleaser.Core.Utilities
{
    public static class TimeManager
    {
        public static bool IsPaused { get; set; }
        public static float CurrentTime { get; set; }
        public static float CurrentUnpausedTime { get; set; }

        public static float Blink
        {
            get
            {
                return (float)(Math.Sin(CurrentUnpausedTime * Math.PI * 3.5f) * 0.5f) + 0.5f;
            }
        }

        public static void Tick(float deltaTime)
        {
            if (!IsPaused)
            {
                CurrentTime += deltaTime;
            }
            CurrentUnpausedTime += CurrentUnpausedTime;
        }

        public static bool IsDoneWaiting(float waitUntilTime)
        {
            return CurrentTime >= waitUntilTime;
        }
    }
}